<template>
    <div>
        通过bus总线得到子组件的消息: {{ childMessage }}
        <component-a></component-a>
    </div>
</template>
<script>
    import ComponentA from '@/views/bus/ComponentA.vue';
    import { EventBus } from '@/views/bus/EventBus.js';


    export default {
        components: {
            ComponentA
        },
        props: {

        },
        data () {
            return {
                childMessage: ""
            }
        },
        mounted(){
            /**
             * 监听来自bus的事件on-message
             */
            EventBus.$on("on-message", (msg) => {
                this.childMessage = msg;
            })
        },
        /**
         * 计算属性
         */
        computed: {

        },
        methods: {

        }
    }
</script>
<style scoped>

</style>